package com.xnyzc.lhy.mis.controller.cmsapi.config;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.param.cms.config.CashWithdrawalConfigParam;
import com.xnyzc.lhy.mis.entity.cms.config.OaSysCashWithdrawalConfig;
import com.xnyzc.lhy.mis.service.cms.config.IOaSysCashWithdrawalConfigService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 提现规则 前端控制器
 * </p>
 * @author baoyaze
 * @since 2019-10-20
 */
@RestController
@RequestMapping("/cmsapi/cashWithdrawalConfig")
public class CashWithdrawalConfigController
{
    @Autowired
    private IOaSysCashWithdrawalConfigService cashWithdrawalConfigService;

    @ApiOperation(value = "查询提现规则", notes = "查询提现规则")
    @PostMapping(value = "getCashWithdrawalConfigList")
    public Rv getList(@ApiParam(name = "cashWithdrawalConfigParam", value = "提现规则查询类") @RequestBody CashWithdrawalConfigParam cashWithdrawalConfigParam)
    {
        return cashWithdrawalConfigService.getCashWithdrawalConfigList(cashWithdrawalConfigParam);
    }

    @ApiOperation(value = "查询提现规则详细", notes = "查询提现规则详细")
    @GetMapping(value = "getCashWithdrawalConfigDetail")
    public Rv getInfo(@ApiParam(name = "configId", value = "提现规则的ID") Long configId)
    {
        return cashWithdrawalConfigService.getCashWithdrawalConfigInfo(configId);
    }

    /**
     * 添加提现规则
     *
     * @param configInfo:接收提现规则的实体类
     * @return
     */
    @ApiOperation(value = "添加提现规则", notes = "添加提现规则")
    @PostMapping(value = "/addCashWithdrawalConfig")
    public Rv addConfig(
        @ApiParam(name = "cashWithdrawalConfigParam", value = "提现规则实体类") @RequestBody OaSysCashWithdrawalConfig configInfo)
    {
        return cashWithdrawalConfigService.addConfig(configInfo);
    }

    /**
     * 更新提现规则
     *
     * @param configInfo:接收提现规则的实体类
     * @return
     */
    @ApiOperation(value = "更新提现规则", notes = "更新提现规则")
    @PostMapping(value = "/updateCashWithdrawalConfig")
    public Rv updateConfig(
        @ApiParam(name = "cashWithdrawalConfigParam", value = "提现规则实体类") @RequestBody OaSysCashWithdrawalConfig configInfo)
    {
        return cashWithdrawalConfigService.updateConfig(configInfo);
    }

    /**
     * 删除提现规则
     *
     * @param configInfo:接收提现规则的实体类
     * @return
     */
    @ApiOperation(value = "删除提现规则", notes = "删除提现规则")
    @PostMapping(value = "/deleteCashWithdrawalConfig")
    public Rv deleteConfig(
        @ApiParam(name = "cashWithdrawalConfigParam", value = "提现规则实体类") @RequestBody OaSysCashWithdrawalConfig configInfo)
    {
        return cashWithdrawalConfigService.deleteConfig(configInfo);
    }
}
